package no.monsen.client.controller;

import no.monsen.client.common.exception.MonsenException;
import no.monsen.client.common.logging.Logger;
import no.monsen.client.common.util.MonsenVersionUtil;
import no.monsen.monsenservice.MonsenFact;
import no.monsen.service.MonsenService;

import org.apache.commons.logging.Log;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * 
 * @author Marius Breivik
 * Created: 22.03.32 / 10. mars. 2008
 */
public class MonsenController {
	
	@Logger
	private Log log;
	
	@Autowired
	private MonsenService monsenConnector;
		
	public String isUpdateAvailable( String clientVersion ){
		try {
			String currentVersion = monsenConnector.isUpdateAvailable( clientVersion );
			return MonsenVersionUtil.validateVersionNumber( currentVersion );
		} catch (MonsenException e) {
			log.error("An error occured during update check." + e);
			return e.getMessage();
		}		
	}
	
	public MonsenFact getScheduledTimeForLunch(){
		
		return null;
	}
}
